//充值
var ws, spage, uid, money, platform = '微信';
document.addEventListener('plusready', function(){
	ws = plus.webview.currentWebview();
	spage = ws.spage;
	uid = plus.storage.getItem('uid');
	money = ws.money;
	console.log(uid+" "+money);
	$('.mui-input-group li').on('tap', function(e){
		platform = $(this).find('label').text();
		switch($(this).index()){
			case 0:	//微信	待接口提供
			ptype = 'wxpay';
			break;
			case 1:	//支付宝		待接口提供
			ptype = 'alipay';
			break;
			case 2:	//银行卡
			toast('待接口提供');
			break;
		}
	})
	//提交
	$('.deposit-btn').on('tap', function(){
		if(platform == '银行卡'){
			return;
		}
		payment(money);
	})
}, false)
function source(){
	$.ajax({
		type:"get",
		url:apiRoot+"/home/income/recharge",
		data:{
			deposit :uid,
			money :money,
			platform :platform,
			tid :117
		},
		success :function(data){
			plus.nativeUI.closeWaiting();
			console.log(data);
			if(data > 0){
				toast('提交成功');
				ws.close();
				if(spage)plus.webview.getWebviewById(spage).close();
				plus.webview.getWebviewById('me-jf-home.html').reload();
			}else{
				toast('提交失败');
			}
		},
		error :function(e){
			errortoast();
			console.log(JSON.stringify(e));
		}
	});
}
